-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issue #2638]
"unwanted" toasts - HatsTreeId not getting reset when Network Changes
#2639
Conversation
✅ Deploy Preview for decent-interface-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for decent-interface-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Really not sure what to do here. Problem:
|
I can try looking into this tomorrow. Can I assume that myosin DAO has no hat tree and might be part of the reason this happens? Cz this is happening in only one direction -- when switching to myosin |
@DarksightKellar its also happening for any DAO switching. it does fix itself for DAOs that already have a Hattree but it still will load the previous DAOs hattree as the Hattree ID doesn't get removed in time. I have plenty of ways that I COULD fix it. I just was hoping to discuss this in realtime to figure out a proper fix. Its the same problem that the other 'load' keys refs were created to fix. This has been an issue since smartAccounts were added. if there was a problem it kinda would keep going with the smartAddress being undefined I just now show it loud clear from the update to |
Issue/2638 Cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating the useEffect
hook in useHatsTree
to be:
const node = useDaoInfoStore();
const safeAddress = node.safe?.address;
const loadKey = useRef<string | null | undefined>(undefined);
useEffect(() => {
const key = safeAddress && hatsTreeId ? `${safeAddress}:${hatsTreeId}` : null;
if (
!!hatsTreeId &&
!!contextChainId &&
!!publicClient &&
key !== null &&
key !== loadKey.current
) {
getHatsTree({
hatsTreeId,
contextChainId,
publicClient,
});
}
loadKey.current = key;
}, [contextChainId, getHatsTree, hatsTreeId, publicClient, safeAddress]);
};
fixes this bug.
8e88522
to
8ceb565
Compare
[Issue #2638]
unwanted toasts[Issue #2638]
"unwanted" toasts - HatsTreeId not getting reset when Network Changes
… tree id as the previously viewed DAO
@Da-Colon the toast was still occurring for me (on netlify and local), so I pushed the loadkey a bit further. Seems to be cool now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DarksightKellar remove the console.log then seems good to me. thanks @Da-Colon and @DarksightKellar
Closes #2638
Did a little refactor as well as with some additional testing. I noticed there was additional calls when switching DAOs because of the extra
useEffect
.So refactored
useHatsTree
a little:useEffect
sanitize
method insetHatTree
workflowother change:
useKeyValuePairs
causing some issues.